From fe13c7ff8b91dcca6f9c62f008547a95328b8f8e Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 7 May 2006 20:30:05 +0000 Subject: [PATCH] Axim fix for Windows. Magprotoc: deal with COMx (x>9) silliness on Windows. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2037 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/axim_gpb.c | 2 +- gpsbabel/magproto.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gpsbabel/axim_gpb.c b/gpsbabel/axim_gpb.c index 9a16fcfc5..49103be37 100644 --- a/gpsbabel/axim_gpb.c +++ b/gpsbabel/axim_gpb.c @@ -141,7 +141,7 @@ axim_gpb_read(void) char buff[RECORD_LEN]; route_head *track = NULL; size_t bytes; - off_t filesize, left; + long filesize, left; fseek(fin, 0, SEEK_END); filesize = ftell(fin); diff --git a/gpsbabel/magproto.c b/gpsbabel/magproto.c index b48f428f5..fd75e9bcb 100644 --- a/gpsbabel/magproto.c +++ b/gpsbabel/magproto.c @@ -524,15 +524,20 @@ int terminit(const char *portname, int create_ok) { DCB tio; + char *xname = xstrdup("\\\\.\\\\"); COMMTIMEOUTS timeout; - is_file = 0; + is_file = 0; + + xname = xstrappend(xname, portname); + if (xname[strlen(xname)-1] == ':') + xname[strlen(xname)-1] = 0; xCloseHandle(comport); - comport = CreateFile(portname, GENERIC_READ|GENERIC_WRITE, 0, NULL, + comport = CreateFile(xname, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - + fprintf(stderr, "Comport: %p %s\n", comport, xname); if (comport == INVALID_HANDLE_VALUE) { goto try_as_file; } -- 2.30.2